﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RandomGenerator
{
    public partial class MainPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Generate_RandomNum(object sender, EventArgs e)
        {
            Random rand = new Random();
            int lowerBound = 0;
            int upperBound = 0;

            try
            {
                lowerBound = int.Parse(this.LowBound.Text);
                upperBound = int.Parse(this.UpperBound.Text);

                this.Result.InnerText = rand.Next(lowerBound, upperBound).ToString();
            }
            catch (Exception)
            {
                this.Result.InnerText = "Invalid.";
            } 
        }
    }
}